package com.jiermt.M0617;

import java.util.LinkedList;

public class LinkedListDemo {
    public static void main(String[] args) {
        LinkedList<String> queue = new LinkedList<>();

        queue.add("hello");
        queue.addLast("world");
        queue.add("java");
        queue.add("jiermt");
        System.out.println(queue);

        // 出队并删掉
        System.out.println(queue.removeFirst());
        System.out.println(queue);
        System.out.println("---------------------------");
        // 做一个站
        LinkedList<String> stack = new LinkedList<>();
          stack.addFirst("hello");
          stack.addFirst("world");// 也可以用push,  但是push是直接添加到头部
          stack.addFirst("java");
          stack.addFirst("jiermt");
          System.out.println(stack);

       /* System.out.println(stack.removeLast());
        System.out.println(stack.removeLast());
        System.out.println(stack.removeLast());
        System.out.println(stack.removeLast());*/

    }
}
